package com.ny.zmb.openapi.enums;

import lombok.Getter;

/**
 *    0  "处理中"
 *    11  "待付款/待确认（密码或短信验证）"
 *    12  "已付款，待发货（仅担保交易适用）"
 *    13  "已发货，待确认收货（仅担保交易适用）"
 *    1  "交易成功"
 *    2  "交易过期/交易关闭"
 *    -1  "交易失败"
 *    21  "部分退款成功"
 *    22  "全额退款成功"
 *    13  "交易冲正"
 *    999  "未知状态，请重新查询"
 */
@Getter
public enum TransactionStatusEnum {
    PROCESSING("PROCESSING", 0, "处理中"),
    WAIT_PAY("WAIT_PAY", 11, "待付款/待确认（密码或短信验证）"),
    WAIT_DELIVERD("WAIT_DELIVERD", 12, "已付款，待发货（仅担保交易适用）"),
    WAIT_CONFIRM("WAIT_CONFIRM", 13, "已发货，待确认收货（仅担保交易适用）"),
    SUCCESS("SUCCESS", 1, "交易成功"),
    CLOSED("CLOSED", 2, "交易过期/交易关闭"),
    FAILED("FAILED", -1, "交易失败"),
    REFUND_PART("REFUND_PART", 21, "部分退款成功"),
    REFUND_ALL("REFUND_ALL", 22, "全额退款成功"),
    REVERSAL("REVERSAL", 13, "交易冲正"),
    UN_KNOW("UN_KNOW", 999, "未知状态，请重新查询");

    private final String code; // 字段不应为 static
    private final int status;
    private final String msg;

    // 构造函数
    TransactionStatusEnum(String code, int status, String msg) {
        this.code = code;
        this.status = status;
        this.msg = msg;
    }

    @Override
    public String toString() {
        return code + ": " + status + ": " + msg;
    }
}
